﻿#include "bomb.h"
#include "config.h"

Bomb::Bomb()
{
    for(int i=0;i<BOMB_MAX;i++){
        QString picPath = QString(BOMB_PATH).arg(i);
        bombAttr.push_back(QPixmap(picPath));
    }

    postion_x =0;
    postion_y =0;

    isFree = true;
    pic_index = 0;

    bombShowCount = 0;


}

void Bomb::updateInfo()
{
    if(isFree){
        return;
    }
    bombShowCount++;

    if(bombShowCount<BOMB_INTERVAL){
        return;
    }

    bombShowCount = 0;

    pic_index++;

    if(pic_index>BOMB_MAX-1){
        pic_index = 0;
        isFree = true;
    }

}

int Bomb::getPicIndex() const
{
    return pic_index;
}

void Bomb::setPicIndex(int value)
{
    pic_index = value;
}

bool Bomb::getIsFree() const
{
    return isFree;
}

void Bomb::setIsFree(bool value)
{
    isFree = value;
}

int Bomb::getPostionX() const
{
    return postion_x;
}

void Bomb::setPostionX(int value)
{
    postion_x = value;
}

int Bomb::getPostionY() const
{
    return postion_y;
}

void Bomb::setPostionY(int value)
{
    postion_y = value;
}
